package com.hfjyz.base.bean;

public class SearchCondition {

    /**
     * page number
     */
    protected int pageNum = 0;

    /**
     * rows' count per page
     */
    protected int rowCountPerPage = 0;

    /**
     * sort col
     */
    protected String sortColumn = null;

    /**
     * sort direction
     */
    protected String sortDirection = null;

    public int getPageNum() {
        return pageNum;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }

    public int getRowCountPerPage() {
        return rowCountPerPage;
    }

    public void setRowCountPerPage(int rowCountPerPage) {
        this.rowCountPerPage = rowCountPerPage;
    }

    public String getSortColumn() {
        return sortColumn;
    }

    public void setSortColumn(String sortColumn) {
        this.sortColumn = sortColumn;
    }

    public String getSortDirection() {
        return sortDirection;
    }

    public void setSortDirection(String sortDirection) {
        this.sortDirection = sortDirection;
    }

    public String getOrderString() {
        if (sortColumn != null) {
            return " order by " + sortColumn + " " + sortDirection;
        } else {
            return "";
        }
    }

    public String getOrderString(String alias1, String alias2) {
        if (sortColumn != null) {
            return " order by " + alias1 + "." + sortColumn + " " + sortDirection;
        } else {
            return "";
        }
    }
}
